﻿using System.Linq.Expressions;

namespace 表达式树
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //Func<Book, bool> f1 = b => b.Price > 5 || b.AuthorName.Contains("test");
            Func<Book, bool> f1 = b => { return b.Price > 5 || b.AuthorName.Contains("test"); };
            Expression<Func<Book, bool>> e = b => b.Price > 5 || b.AuthorName.Contains("test");
            Console.WriteLine(f1);
            Console.WriteLine(e);

            using (MyDbContext ctx = new MyDbContext())
            {
                ctx.Books.Where(e).ToArray();
            }
        }
    }
}
